function [stat] = getStatusNew(sshConnection)

path = 'boats\ code/New\ Boats\ Code/Outputs/';

scp_get(sshConnection, 'status.txt', '', path);

fid = fopen('status.txt');
statusDump = fscanf(fid, '%s');

stat.started = str2double(myParse(statusDump, 'started'));
stat.state = myParse(statusDump, 'state');
stat.time = myParse(statusDump, 'time');
switch stat.state
    case 'Waypoint'
        stat.commandLat =  str2double(myParse(statusDump, 'commandLat'));
        stat.commandLon =  str2double(myParse(statusDump, 'commandLon'));
        stat.commandPrecision =  str2double(myParse(statusDump, 'commandPrecision'));
        stat.commandSpeed =  str2double(myParse(statusDump, 'commandSpeed'));
    otherwise
        stat.commandLat = NaN;
        stat.commandLon = NaN;
end

stat.lat = str2double(myParse(statusDump, 'lat'));
stat.lon = str2double(myParse(statusDump, 'lon'));
stat.compass = str2double(myParse(statusDump, 'compass'));
stat.temp = str2double(myParse(statusDump, 'temp'));
%stat.boat = whichBoat; % I may read this from the status file in the future, but should be the same as this
end



function [retString] = myParse(statusDump, tag)
%% parses XML data
%% grabs first substring in statusDump contained within <tag>__data here__</tag> 

retString = statusDump(strfind(statusDump, ['<' tag '>']) + length(['<' tag '>']):strfind(statusDump, ['</' tag '>'])-1);


end